package com.etc.entity;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class User implements Serializable {

    private static final long serialVersionUID = 6430505094592954825L;
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    private static final int USER_LEVEL = 1;
    private static final int USER_STATUS = 1;
    private Integer userId;
    private String userName;
    private String userPwd;
    private String email;
    private String sex;
    private String birthday;
    private String tel;
    private Integer level;
    private Integer status;
    private String uDate;

    @Override
    public String toString() {
        return "User [userId=" + userId + ", userName=" + userName + ", userPwd=" + userPwd + ", email=" + email
                + ", sex=" + sex + ", birthday=" + birthday + ", tel=" + tel + ", level=" + level + ", status=" + status
                + ", uDate=" + uDate + "]";
    }

    public User() {
        super();
    }

    public User(String tel) {
        this.tel = tel;
        this.level = USER_LEVEL;
        this.status = USER_STATUS;
        this.uDate = sdf.format(new Date());
    }

    /**
     * 没带userId，自动增长
     *
     * @param userName
     * @param userPwd
     * @param email
     * @param sex
     * @param birthday
     * @param tel
     * @param level
     * @param status
     */
    public User(String userName, String userPwd, String email, String sex, String birthday, String tel, Integer level,
                Integer status) {
        super();
        this.userName = userName;
        this.userPwd = userPwd;
        this.email = email;
        this.sex = sex;
        this.birthday = birthday;
        this.tel = tel;
        this.level = USER_LEVEL;
        this.status = USER_STATUS;
        this.uDate = sdf.format(new Date());
    }

    /**
     * 带了userId
     *
     * @param userId
     * @param userName
     * @param userPwd
     * @param email
     * @param sex
     * @param birthday
     * @param tel
     * @param level
     * @param status
     */
    public User(Integer userId, String userName, String userPwd, String email, String sex, String birthday, String tel,
                Integer level, Integer status) {
        super();
        this.userId = userId;
        this.userName = userName;
        this.userPwd = userPwd;
        this.email = email;
        this.sex = sex;
        this.birthday = birthday;
        this.tel = tel;
        this.level = USER_LEVEL;
        this.status = USER_STATUS;
        this.uDate = sdf.format(new Date());
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd == null ? null : userPwd.trim();
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex == null ? null : sex.trim();
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday == null ? null : birthday.trim();
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel == null ? null : tel.trim();
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getUdate() {
        return uDate;
    }

    public void setUdate(String uDate) {
        this.uDate = uDate;
    }
}